From: Sebastian Keller Date: Sat, 25 Dec 2021 23:19:25 +0000 (+0100) Subject: messageTray: Close SHOWING banner when its notification is destroyed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~536^2^2~10 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=2801d0bfe3ebd66fec76766d05133b327e498535;p=gnome-shell.git messageTray: Close SHOWING banner when its notification is destroyed Currently only banners in the SHOWN state are hidden when the underlying notification is destroyed, but if they are in the SHOWING state, they remain visible. Because the 'notification' member has already been set to null when the notification got destroyed, closing the banner by clicking on the close button, will not do anything and clicking on the notification itself will result in an error message. For notifications without a timeout, i.e. critical ones, this will result in an uncloseable notification. This can happen if the program creating a critical notification immediately closes it again, as might happen with power notifications from gnome-settings-daemon in some situations. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4855 Part-of: --- diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 8a5c262a9..8e403f308 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -1204,7 +1204,8 @@ var MessageTray = GObject.registerClass({ if (showNextNotification) this._showNotification(); } - } else if (this._notificationState == State.SHOWN) { + } else if (this._notificationState === State.SHOWING || + this._notificationState === State.SHOWN) { let expired = (this._userActiveWhileNotificationShown && this._notificationTimeoutId == 0 && this._notification.urgency != Urgency.CRITICAL && @@ -1215,10 +1216,12 @@ var MessageTray = GObject.registerClass({ if (mustClose) { let animate = hasNotifications && !this._notificationRemoved; this._hideNotification(animate); - } else if (this._pointerInNotification && !this._banner.expanded) { - this._expandBanner(false); - } else if (this._pointerInNotification) { - this._ensureBannerFocused(); + } else if (this._notificationState === State.SHOWN && + this._pointerInNotification) { + if (!this._banner.expanded) + this._expandBanner(false); + else + this._ensureBannerFocused(); } }